home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / dynPaintToolbar.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  23.9 KB  |  764 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17.  
  18. global string $dynPaintSceneToolsToolbox = "";
  19. global string $dynPaintCanvasToolsToolbox = "";
  20. global string $dynPaintTubeTools = "";
  21. global string $dynPaintLeafTools = "";
  22. global string $dynPaintFlowerTools = "";
  23. global string $dynPaintBudTools = "";
  24. global string $dynPaintToolbar;
  25.  
  26.  
  27. global proc doCanvasClear(string $editor)
  28.  
  29. //
  30. //    This procedure is executed when the user clicks on the clear icon.
  31. //     It prompts the user for confirmation first and then clears the canvas
  32. //    or deletes strokes in the scene.
  33. //
  34.  
  35. {
  36.     global string $gDynPaintEditorName; 
  37.  
  38.     // if we're in canvas mode .. clear the canvas
  39.  
  40.     if( `dynPaintEditor -q -canvasMode $gDynPaintEditorName` ) {
  41.  
  42.         // if autosave is on warn the user about data loss
  43.  
  44. //        if ( `dynPaintEditor -q -autoSave $gDynPaintEditorName`) {
  45. //
  46. //            string $confirmClear = `confirmDialog 
  47. //                -m "Clear the Canvas? \n \n Auto Save is on, you will lose your work. \n"
  48. //                -button "Clear" 
  49. //                -button "Cancel" 
  50. //                -defaultButton "Cancel"
  51. //                -cancelButton "Cancel"`;
  52. //        
  53. //            if ($confirmClear == "Clear") {
  54. //
  55.  
  56.  
  57. //        if ( `dynPaintEditor -q -autoSave $gDynPaintEditorName`) {
  58. //                // turn off autosave
  59. //                toggleAutoSave ($editor);
  60. //        }
  61.  
  62.                 // clear the canvas
  63.                 float $cc[] = `optionVar -q dynPaintPanelClearColour`;
  64.                   dynPaintEditor -e -cl $cc[0] $cc[1] $cc[2] $editor;
  65. //            }
  66. //
  67. //        }
  68.     
  69. //        // autosave is off .. just clear the canvas
  70. //    
  71. //        else {
  72. //            float $cc[] = `optionVar -q dynPaintPanelClearColour`;
  73. //             dynPaintEditor -e -cl $cc[0] $cc[1] $cc[2] $editor;
  74. //        }
  75.  
  76.     } else {     // we're in paint scene mode .. delete strokes
  77.  
  78.             deleteAllStrokes();
  79.     }
  80. }
  81.  
  82.  
  83. global proc setDynPaintOnlyToolbox( int $state )
  84. {
  85. //    global string $dynPaintSceneToolsToolbox;
  86. //    
  87. // if( size(  $dynPaintSceneToolsToolbox ) > 0 )
  88. // {
  89. //        setParent $dynPaintSceneToolsToolbox;
  90. //        symbolCheckBox -e -v $state "activeOnlyCheckBox";
  91. // }
  92. }
  93.  
  94. global proc setDynPaintAutoSaveToolbox( int $state )
  95. {
  96.     global string $dynPaintSceneToolsToolbox;
  97.     
  98.     if( size(  $dynPaintSceneToolsToolbox ) > 0 )
  99.     {
  100.         setParent $dynPaintSceneToolsToolbox;
  101.         symbolCheckBox -e -v $state "autoSaveCheckBox";
  102.     }
  103. }
  104.  
  105. global proc setShowLeafTools()
  106. {
  107.     global string $dynPaintLeafTools;
  108.     string $defBrush = getDefaultBrush();
  109.     if( size( $dynPaintLeafTools ) > 0 )
  110.     {
  111.         int $leaves = getAttr( $defBrush + ".leaves" );
  112.         int $tubes = getAttr( $defBrush + ".tubes" );
  113.         $leaves = ($leaves && $tubes);
  114.  
  115.         setParent $dynPaintLeafTools;
  116.         attrColorSliderGrp -e -manage $leaves brushLC1;
  117.         attrColorSliderGrp -e -manage $leaves brushLC2;
  118.     }
  119. }
  120.  
  121. global proc setShowFlowerTools()
  122. {
  123.     global string $dynPaintFlowerTools;
  124.  
  125.     string $defBrush = getDefaultBrush();
  126.     if( size( $dynPaintFlowerTools ) > 0 )
  127.     {
  128.         int $flowers = getAttr( $defBrush + ".flowers" );
  129.         int $tubes = getAttr( $defBrush + ".tubes" );
  130.         $flowers = ($flowers && $tubes );
  131.  
  132.         setParent $dynPaintFlowerTools;
  133.         attrColorSliderGrp -e -manage $flowers brushPC1;
  134.         attrColorSliderGrp -e -manage $flowers brushPC2;
  135.     }
  136. }
  137.  
  138. global proc setShowBudTools()
  139. {
  140.     global string $dynPaintBudTools;
  141.  
  142.     string $defBrush = getDefaultBrush();
  143.     if( size( $dynPaintBudTools ) > 0 )
  144.     {
  145.         int $buds = getAttr( $defBrush + ".buds" );
  146.         int $tubes = getAttr( $defBrush + ".tubes" );
  147.         $buds = ($buds && $tubes);
  148.  
  149.         setParent $dynPaintBudTools;
  150.         attrColorSliderGrp -e -manage $buds brushBC;
  151.     }
  152. }
  153.  
  154. global proc setShowTubeTools()
  155. {
  156.     global string $dynPaintTubeTools;
  157.  
  158.     string $defBrush = getDefaultBrush();
  159.     if( size( $dynPaintTubeTools ) > 0 )
  160.     {
  161.         int $tubes = getAttr( $defBrush + ".tubes" );
  162.  
  163.         setParent $dynPaintTubeTools;
  164.  
  165.         attrFieldSliderGrp -e -manage $tubes brushTS;
  166.         attrColorSliderGrp -e -manage $tubes brushC2;
  167.         attrColorSliderGrp -e -manage $tubes brushT2;
  168.         setShowLeafTools();
  169.         // formLayout -e -manage $tubes "leafTools";
  170.         setShowFlowerTools();
  171.         // formLayout -e -manage $tubes "flowerTools";
  172.         setShowBudTools();
  173.         // formLayout -e -manage $tubes "budTools";
  174.     }
  175. }
  176.  
  177. global proc setDynPaintModeToolbox( int $mode )
  178. {
  179. //    global string $dynPaintSceneToolsToolbox;
  180. //
  181. //    if( size(  $dynPaintSceneToolsToolbox ) > 0 )
  182. //    {
  183. //
  184. //        setParent $dynPaintSceneToolsToolbox;
  185. //    
  186. //        switch( $mode )
  187. //        {
  188. //            case 0:
  189. //                symbolCheckBox -e -v 1 "refreshOffCheckBox";
  190. //                symbolCheckBox -e -v 0 "refreshWireCheckBox";
  191. //                symbolCheckBox -e -v 0 "refreshRenderedCheckBox";
  192. //            break;
  193. //            case 1:
  194. //                symbolCheckBox -e -v 0 "refreshOffCheckBox";
  195. //                symbolCheckBox -e -v 1 "refreshWireCheckBox";
  196. //                symbolCheckBox -e -v 0 "refreshRenderedCheckBox";
  197. //            break;
  198. //                    case 2:
  199. //                symbolCheckBox -e -v 0 "refreshOffCheckBox";
  200. //                symbolCheckBox -e -v 0 "refreshWireCheckBox";
  201. //                symbolCheckBox -e -v 1 "refreshRenderedCheckBox";
  202. //            break;
  203. //        }    
  204. //    }
  205. }
  206.  
  207.  
  208. global proc showDynPaintSceneTools( int $state )
  209. {
  210.     global string $dynPaintSceneToolsToolbox;
  211.     global string $dynPaintCanvasToolsToolbox;
  212.     global string $dynPaintToolbar;
  213.  
  214.     if( size(  $dynPaintSceneToolsToolbox ) > 0 )
  215.     {
  216.         setParent $dynPaintSceneToolsToolbox;
  217.         symbolButton -e -manage $state "renderButton";
  218. //        symbolCheckBox -e -manage $state "refreshOffCheckBox";
  219. //        symbolCheckBox -e -manage $state "refreshWireCheckBox";
  220. //        symbolCheckBox -e -manage $state "refreshRenderedCheckBox";
  221. //        symbolCheckBox -e -manage $state "activeOnlyCheckBox";
  222.  
  223.         setParent $dynPaintCanvasToolsToolbox;
  224.         symbolCheckBox -e -manage (!$state) "autoSaveCheckBox";
  225.         symbolCheckBox -e -manage (!$state) "wrapHCheckBox";
  226.         symbolCheckBox -e -manage (!$state) "wrapVCheckBox";
  227.     }
  228. }
  229.  
  230. global proc dynPaintRenderAll( string $editor )
  231. {
  232.     int $strokeRedraw = `dynPaintEditor -q -refreshMode $editor`;
  233.     dynPaintEditor -edit -refreshMode 2 $editor;
  234.     dynPaintEditor -edit -pa 0  $editor;
  235.     dynPaintEditor -edit -refreshMode $strokeRedraw   $editor;
  236. }
  237.  
  238. global proc dynPaintToolbarConnectControls( string $tubes,
  239.                                             string $color1,
  240.                                             string $transparency1,
  241.                                             string $tubesPerStep,
  242.                                             string $color2,
  243.                                             string $transparency2,
  244.                                             string $leafColor1,
  245.                                             string $leafColor2,
  246.                                             string $petalColor1,
  247.                                             string $petalColor2,
  248.                                             string $budColor )
  249. {
  250.     string $defBrush = getDefaultBrush();
  251.     connectControl $tubes ( $defBrush + ".tubes" );
  252.  
  253.     // C, T color sliders
  254.     //
  255.     attrColorSliderGrp -e -at ( $defBrush + ".color1" ) $color1;
  256.     attrColorSliderGrp -e -at ( $defBrush + ".transparency1" ) $transparency1;
  257.  
  258.     // TS float field
  259.     // 
  260.     attrFieldSliderGrp -e -at ( $defBrush + ".tubesPerStep" ) $tubesPerStep;
  261.  
  262.     // C2, T2 color sliders
  263.     //
  264.     attrColorSliderGrp -e -at ( $defBrush + ".color2" ) $color2;
  265.     attrColorSliderGrp -e -at ( $defBrush + ".transparency2" ) $transparency2;
  266.  
  267.     // L1, L2 color boxes
  268.     //
  269.     attrColorSliderGrp -e -at ($defBrush+".leafColor1") $leafColor1;
  270.     attrColorSliderGrp -e -at ($defBrush+".leafColor2") $leafColor2;
  271.  
  272.     // P1, P2 color boxes
  273.     // 
  274.     attrColorSliderGrp -e -at ($defBrush+".petalColor1") $petalColor1;
  275.     attrColorSliderGrp -e -at ($defBrush+".petalColor2") $petalColor2;
  276.  
  277.     // B color box
  278.     //
  279.     attrColorSliderGrp -e -at ($defBrush+".budColor") $budColor;
  280.  
  281.     // These enable/disable display of some of the above widgets
  282.     // based on settings in the default brush.
  283.     //
  284.     scriptJob -parent $tubes -replacePrevious 
  285.         -attributeChange ($defBrush + ".tubes") setShowTubeTools;
  286.     scriptJob -parent $leafColor1 -replacePrevious 
  287.         -attributeChange ($defBrush + ".leaves") setShowLeafTools;
  288.     scriptJob -parent $petalColor1 -replacePrevious 
  289.         -attributeChange ($defBrush + ".flowers") setShowFlowerTools;
  290.     scriptJob -parent $budColor -replacePrevious 
  291.         -attributeChange ($defBrush + ".buds") setShowBudTools;
  292.  
  293.     // The settings in the default brush have changed.  Calling this
  294.     // ensures we're displaying the right set of widgets for the 
  295.     // default brush.
  296.     //
  297.     setShowTubeTools();    
  298. }
  299.  
  300. global proc string dynPaintToolbar( string $editor )
  301. {
  302.     global string $dynPaintSceneToolsToolbox;
  303.     global string $dynPaintCanvasToolsToolbox;
  304.     global string $dynPaintTubeTools;
  305.     global string $dynPaintLeafTools;
  306.     global string $dynPaintFlowerTools;
  307.     global string $dynPaintBudTools;
  308.     global string $dynPaintToolbar;
  309.  
  310.     string $flipTubeButton;
  311.  
  312.     string $toolbar = `formLayout "dptoolbar"`;
  313.     $dynPaintToolbar = $toolbar;
  314.  
  315.     symbolButton
  316.         -image "hsClearView.xpm"
  317.         -width 28 -height 28
  318.         -annotation "Clear Canvas/Delete All Strokes"
  319.     -command ("doCanvasClear(\"" + $editor + "\")")
  320.         canvasClearButton;
  321.  
  322.         symbolButton
  323.               -image "rvAllPlanes.xpm"
  324.               -width 28 -height 28
  325.               -annotation "Display RGB Channels"
  326.               -command                 
  327.                   ("dynPaintEditor "
  328.                    + "-edit "
  329.                    + "-displayStyle \"color\" "
  330.                     + "-scaleRed 1 "
  331.                     + "-scaleGreen 1 "
  332.                     + "-scaleBlue 1 " 
  333.                     + $editor )
  334.             allPlanesButton;
  335.  
  336.         symbolButton
  337.                -image "rvMaskPlane.xpm"
  338.                -width 28 -height 28
  339.                -annotation "Display Alpha Channel"
  340.                -command                 
  341.                    ("dynPaintEditor "
  342.                     + "-edit "
  343.                     + "-displayStyle \"mask\" " 
  344.                     + $editor )
  345.             maskButton;
  346.  
  347.         symbolButton
  348.                -image "rvRealSize.xpm"
  349.                -width 28 -height 28
  350.                -annotation "Display Paint Effects View at actual (pixel) size"
  351.                -command
  352.                    ("dynPaintEditor "
  353.                     + "-edit "
  354.                     + "-zoom 1 "
  355.                     + $editor)
  356.             realSizeButton;
  357.  
  358.         symbolButton
  359.              -image "savePaintSnapshot.xpm"
  360.             -width 28 -height 28
  361.             -annotation 
  362.                 "Save a snapshot of what is currently displayed to a file."
  363.             -command ("dynPaintSaveDialog(\"" + $editor + "\")")
  364.              snapShotButton;
  365.  
  366.         string $canvasTools = `formLayout "canvasTools"`;
  367.         $dynPaintCanvasToolsToolbox = $canvasTools;
  368.             int $autoSave = `dynPaintEditor -q -autoSave $editor`;
  369.             symbolCheckBox
  370.                    -v $autoSave
  371.                   -image "paintAutoSave.xpm"
  372.                    -width 28 -height 28
  373.                    -annotation "Save canvas after every stroke, updating textures."
  374.                    -onc  ("dynPaintSave " + $editor + ";toggleAutoSave " + $editor) 
  375.                    -ofc  ("toggleAutoSave " + $editor) 
  376.                 autoSaveCheckBox;
  377.  
  378.             symbolCheckBox
  379.                   -image "paintWrapH.xpm"
  380.                    -width 28 -height 28
  381.                    -annotation "Wrap Canvas Horizontally"
  382.                 wrapHCheckBox;
  383.             //
  384.             //    Attach this check box to the Stroke Globals Horizontal Wrap
  385.             //    attribute.  This will keep the attribute in sync with the 
  386.             //    control and vise-versa.  Bug #115364 - bwk 14jul99.
  387.             //
  388.             connectControl wrapHCheckBox strokeGlobals.wrapH;
  389.             
  390.             symbolCheckBox
  391.                   -image "paintWrapV.xpm"
  392.                    -width 28 -height 28
  393.                    -annotation "Wrap Canvas Vertically"
  394.                 wrapVCheckBox;
  395.             //
  396.             //    Attach this check box to the Stroke Globals Vertical Wrap
  397.             //    attribute.  This will keep the attribute in sync with the
  398.             //    control and vise-versa.  Bug #115364 - bwk 14jul99.
  399.             //
  400.             connectControl wrapVCheckBox strokeGlobals.wrapV;
  401.  
  402.             formLayout
  403.                 -edit
  404.  
  405.                 -attachForm    "autoSaveCheckBox"   "left" 1
  406.                 -attachNone    "autoSaveCheckBox"   "right"
  407.                 -attachForm     "autoSaveCheckBox"   "top" 1
  408.                 -attachForm     "autoSaveCheckBox"   "bottom" 1
  409.  
  410.                 -attachControl "wrapHCheckBox"   "left" 1 "autoSaveCheckBox"
  411.                 -attachNone    "wrapHCheckBox"   "right"
  412.                 -attachForm     "wrapHCheckBox"   "top" 1
  413.                 -attachForm     "wrapHCheckBox"   "bottom" 1
  414.  
  415.                 -attachControl "wrapVCheckBox"   "left" 1 "wrapHCheckBox"
  416.                 -attachNone    "wrapVCheckBox"   "right"
  417.                 -attachForm     "wrapVCheckBox"   "top" 1
  418.                 $canvasTools;
  419.         setParent ..;
  420.         
  421.         string $sceneTools = `formLayout "sceneTools"`;
  422.         $dynPaintSceneToolsToolbox = $sceneTools;
  423.             symbolButton
  424.                   -image "redrawPaintEffects.xpm"
  425.                   -width 28 -height 28
  426.                   -annotation "Redraw Paint Effects View"
  427.                   -command
  428.                 ("dynPaintRenderAll " + $editor)
  429.             renderButton;
  430.  
  431.             int $activeRef = `dynPaintEditor -q -ao $editor`;
  432. //            symbolCheckBox
  433. //                   -v $activeRef
  434. //                  -image "refreshSelectedOnly.xpm"
  435. //                   -width 28 -height 28
  436. //                   -annotation "Refresh only selected strokes."
  437. //                   -cc  ("toggleActiveOnlyStrokeRefresh " + $editor) 
  438. //                activeOnlyCheckBox;
  439.     
  440. //            symbolCheckBox
  441. //                   -v false
  442. //                  -image "strokeRefreshOff.xpm"
  443. //                   -width 28 -height 28
  444. //                   -annotation "Stroke Refresh Off"
  445. //                   -onc  ("setStrokeRefreshMode 0 " + $editor)
  446. //                refreshOffCheckBox;
  447.     
  448. //            symbolCheckBox
  449. //                   -v true
  450. //                  -image "strokeRefreshWireframe.xpm"
  451. //                   -width 28 -height 28
  452. //                   -annotation "Wireframe Stroke Refresh"
  453. //                   -onc  ("setStrokeRefreshMode 1 " + $editor)
  454. //                refreshWireCheckBox;
  455.     
  456. //            symbolCheckBox
  457. //                   -v false
  458. //                 -image "strokeRefreshRendered.xpm"
  459. //                   -width 28 -height 28
  460. //                   -annotation "Rendered Stroke Refresh"
  461. //                   -onc  ("setStrokeRefreshMode 2 " + $editor)
  462. //                refreshRenderedCheckBox;
  463.  
  464.             formLayout
  465.                 -edit
  466.              -attachForm    "renderButton"   "left" 1
  467.              -attachNone    "renderButton"   "right"
  468.              -attachForm     "renderButton"   "top" 1
  469.              -attachForm     "renderButton"   "bottom" 1
  470.  
  471. //             -attachControl  "activeOnlyCheckBox" "left" 10 "renderButton"
  472. //             -attachNone    "activeOnlyCheckBox"   "right"
  473. //             -attachForm     "activeOnlyCheckBox"   "top" 1
  474.  
  475. //             -attachControl  "refreshOffCheckBox" "left" 10 "activeOnlyCheckBox"
  476. //             -attachNone     "refreshOffCheckBox" "right"
  477. //             -attachForm     "refreshOffCheckBox"  "top" 1
  478.  
  479. //             -attachControl  "refreshWireCheckBox" "left" 1 "refreshOffCheckBox"
  480. //             -attachNone     "refreshWireCheckBox"   "right"
  481. //             -attachForm     "refreshWireCheckBox"   "top" 1
  482.  
  483. //             -attachControl  "refreshRenderedCheckBox"  "left" 1 "refreshWireCheckBox"
  484. //             -attachNone     "refreshRenderedCheckBox"  "right"
  485. //             -attachForm     "refreshRenderedCheckBox"   "top" 1
  486.             $sceneTools;
  487.         setParent ..;
  488.  
  489.         symbolButton
  490.                     -image "templateBrushSettingsSmall.xpm"
  491.                     -width 28 -height 28
  492.                     -annotation "Edit Template Brush"
  493.                     -command "brushToolSettings"
  494.             brushEditorButton;
  495.  
  496.         symbolButton
  497.             -image "paintEffectsBrushes.xpm"
  498.             -width 28 - height 28
  499.             -annotation "Get Brush"
  500.             -command "VisorWindow"
  501.             // for future use
  502.             // -command "VisorWindow paintEffects"
  503.             brushesButton;
  504.  
  505.         // Now define all the controls we want to connect to the
  506.         // default brush.
  507.         //
  508.         string $tubeCheckBox = `symbolCheckBox
  509.             -image "createTubes.xpm"
  510.                -width 28 -height 28
  511.                -annotation "Make Tubes"
  512.             -onc ("setAttr (getDefaultBrush() + \".tubes\") 1")
  513.             -ofc ("setAttr (getDefaultBrush() + \".tubes\") 0")
  514.             tubeCheckBox`;
  515.  
  516.         symbolButton
  517.             -image "flipTubeSmall.xpm"
  518.                     -width 28 -height 28
  519.             -annotation "Flip the Tube Direction on the Current Brush"
  520.             -command "changeTubeDirection"
  521.             flipTubeButton;
  522.  
  523.  
  524.         string $brushC1 = `attrColorSliderGrp -label "C" -ann "color 1" 
  525.             -w 115 -h 28 -sb 0 -cw4 20 30 60 1 brushC1`;
  526.  
  527.         string $brushT1 = `attrColorSliderGrp -label "T" -ann "transparency 1" 
  528.             -w 115 -h 28 -sb 0 -cw4 20 30 60 1 brushT1`;
  529.  
  530.         string $tubeTools = `formLayout "tubeTools"`;
  531.         $dynPaintTubeTools = $tubeTools;
  532.  
  533.             string $brushTS = `attrFieldSliderGrp -label "TS" 
  534.                 -ann "Tubes Per Step" -pre 2 
  535.                 -h 28 -w 77 -cw4 28 50 60 1 brushTS`;
  536.  
  537.             string $brushC2 = `attrColorSliderGrp -label "C2" -ann "color 2" 
  538.                 -w 121 -h 28 -sb 0 -cw4 28 30 60 1 brushC2`;
  539.  
  540.             string $brushT2 = `attrColorSliderGrp -label "T2" 
  541.                 -ann "transparency 2" 
  542.                 -w 121 -h 28 -sb 0 -cw4 28 30 60 1 brushT2`;
  543.  
  544.             string $leafTools = `formLayout "leafTools"`;
  545.             $dynPaintLeafTools = $leafTools;
  546.  
  547.                 string $brushLC1 = `attrColorSliderGrp -label "L1" 
  548.                     -ann "leaf color 1" 
  549.                     -w 58 -h 28 -sb 0 -cw4 28 30 60 1 brushLC1`;
  550.  
  551.                 string $brushLC2 = `attrColorSliderGrp -label "L2" 
  552.                     -ann "leaf color 2" 
  553.                     -w 58 -h 28 -sb 0 -cw4 28 30 60 1 brushLC2`;
  554.  
  555.                 formLayout
  556.                     -edit
  557.  
  558.                     -attachForm     $brushLC1   "left" 1
  559.                     -attachNone     $brushLC1   "right"
  560.                     -attachForm     $brushLC1   "top" 1
  561.                     -attachForm     $brushLC1   "bottom" 1
  562.  
  563.                     -attachControl  $brushLC2   "left" 1 $brushLC1
  564.                     -attachNone     $brushLC2   "right"
  565.                     -attachForm     $brushLC2   "top" 1
  566.                     -attachForm     $brushLC2   "bottom" 1
  567.                     $leafTools;
  568.  
  569.  
  570.                 setParent..;
  571.  
  572.             string $flowerTools = `formLayout "flowerTools"`;
  573.             $dynPaintFlowerTools = $flowerTools;
  574.  
  575.                 string $brushPC1 = `attrColorSliderGrp -label "P1" 
  576.                     -ann "petal color 1" -w 58 -h 28 -sb 0 
  577.                     -cw4 28 30 60 1 brushPC1`;
  578.  
  579.                 string $brushPC2 = `attrColorSliderGrp -label "P2" 
  580.                     -ann "petal color 2" -w 58 -h 28 -sb 0 
  581.                     -cw4 28 30 60 1 brushPC2`;
  582.  
  583.                 formLayout
  584.                     -edit
  585.                     -attachForm     $brushPC1   "left" 1
  586.                     -attachNone     $brushPC1   "right"
  587.                     -attachForm     $brushPC1   "top" 1
  588.                     -attachForm     $brushPC1   "bottom" 1
  589.  
  590.                     -attachControl  $brushPC2   "left" 1 $brushPC1
  591.                     -attachNone     $brushPC2   "right"
  592.                     -attachForm     $brushPC2   "top" 1
  593.                     -attachForm     $brushPC2   "bottom" 1
  594.                     $flowerTools;
  595.  
  596.                 setParent..;
  597.  
  598.             string $budTools = `formLayout "budTools"`;
  599.             $dynPaintBudTools = $budTools;
  600.  
  601.                 string $brushBC = `attrColorSliderGrp -label "B" 
  602.                     -ann "bud color" -w 55 -h 28 -sb 0 
  603.                     -cw4 25 30 60 1 brushBC`;
  604.  
  605.                 formLayout
  606.                     -edit
  607.                     -attachForm     $brushBC   "left" 1
  608.                     -attachNone     $brushBC   "right"
  609.                     -attachForm     $brushBC   "top" 1
  610.                     -attachForm     $brushBC   "bottom" 1
  611.                     $budTools;
  612.                 setParent..;
  613.  
  614.             formLayout
  615.                 -edit
  616.                 -attachForm     $brushTS   "left" 1
  617.                 -attachNone     $brushTS   "right"
  618.                 -attachForm     $brushTS   "top" 1
  619.                 -attachForm     $brushTS   "bottom" 1
  620.  
  621.                 -attachControl  $brushC2   "left" 7 $brushTS 
  622.                 -attachNone     $brushC2   "right"
  623.                 -attachForm     $brushC2   "top" 1
  624.                 -attachForm     $brushC2   "bottom" 1
  625.     
  626.                 -attachControl  $brushT2   "left" 1 $brushC2
  627.                 -attachNone     $brushT2   "right"
  628.                 -attachForm     $brushT2   "top" 1
  629.                 -attachForm     $brushT2   "bottom" 1
  630.  
  631.                 -attachControl  $leafTools   "left" 1 $brushT2
  632.                 -attachNone     $leafTools   "right"
  633.                 -attachForm     $leafTools   "top" 0
  634.                 -attachForm     $leafTools   "bottom" 0
  635.  
  636.                 -attachControl  $flowerTools   "left" 1 $leafTools 
  637.                 -attachNone     $flowerTools   "right"
  638.                 -attachForm     $flowerTools   "top" 0
  639.                 -attachForm     $flowerTools   "bottom" 0
  640.  
  641.                 -attachControl  $budTools   "left" 1 $flowerTools 
  642.                 -attachNone     $budTools   "right"
  643.                 -attachForm     $budTools   "top" 0
  644.                 -attachForm     $budTools   "bottom" 0
  645.  
  646.                 $tubeTools;
  647.             setParent..;
  648.  
  649.         formLayout
  650.             -edit
  651.             -attachForm "canvasClearButton"   "left" 1
  652.             -attachNone "canvasClearButton"   "right"
  653.             -attachForm "canvasClearButton"   "top" 1
  654.  
  655.             -attachControl    "allPlanesButton"   "left" 1 "canvasClearButton"
  656.             -attachNone     "allPlanesButton"   "right"
  657.             -attachForm     "allPlanesButton"   "top" 1
  658.             -attachForm     "allPlanesButton"   "bottom" 1
  659.  
  660.             -attachControl  "maskButton"        "left" 1 "allPlanesButton"
  661.             -attachNone     "maskButton"        "right"
  662.             -attachForm     "maskButton"        "top" 1
  663.  
  664.             -attachControl  "realSizeButton"    "left" 1 "maskButton"
  665.             -attachNone     "realSizeButton"    "right"
  666.             -attachForm     "realSizeButton"    "top" 1
  667.  
  668.             -attachControl  "snapShotButton"    "left" 10 "realSizeButton"
  669.             -attachNone     "snapShotButton"    "right"
  670.             -attachForm     "snapShotButton"    "top" 1
  671.  
  672.  
  673.             -attachControl  "brushEditorButton"   "left" 10 "snapShotButton"
  674.             -attachNone     "brushEditorButton"   "right"
  675.             -attachForm     "brushEditorButton"   "top" 1
  676.  
  677.         -attachControl "brushesButton"    "left" 1 "brushEditorButton"
  678.             -attachNone    "brushesButton"   "right"
  679.         -attachForm    "brushesButton"   "top" 1
  680.  
  681.             -attachControl  $canvasTools  "left" 10 "brushesButton"
  682.             -attachNone     $canvasTools  "right"
  683.         -attachForm     $canvasTools  "top" 0
  684.  
  685.             -attachControl  $sceneTools   "left" 10 "canvasTools"
  686.             -attachNone     $sceneTools   "right"
  687.             -attachForm     $sceneTools   "top" 0
  688.  
  689.             -attachControl  $tubeCheckBox   "left" 10 $sceneTools 
  690.             -attachNone     $tubeCheckBox   "right"
  691.             -attachForm     $tubeCheckBox   "top" 1
  692.  
  693.  
  694.         -attachControl "flipTubeButton"    "left" 1 $tubeCheckBox
  695.             -attachNone    "flipTubeButton"   "right"
  696.         -attachForm    "flipTubeButton"   "top" 1
  697.  
  698.  
  699.             -attachControl  $brushC1   "left" 10 "flipTubeButton" 
  700.             -attachNone     $brushC1   "right"
  701.             -attachForm     $brushC1   "top" 1
  702.  
  703.             -attachControl  $brushT1   "left" 1 $brushC1
  704.             -attachNone     $brushT1   "right"
  705.             -attachForm     $brushT1   "top" 1
  706.  
  707.             -attachControl  $tubeTools   "left" 7 $brushT1
  708.             -attachNone     $tubeTools   "right"
  709.             -attachForm     $tubeTools   "top" 0
  710.  
  711.  
  712.             $toolbar;
  713.  
  714.  
  715.         // Here is the list of all the controls that are to be
  716.         // connected to the default brush.
  717.         //
  718.         string $controlsToConnect[] = { $tubeCheckBox, 
  719.                                         $brushC1, $brushT1,
  720.                                         $brushTS, 
  721.                                         $brushC2, $brushT2, 
  722.                                         $brushLC1, $brushLC2, 
  723.                                         $brushPC1, $brushPC2, 
  724.                                         $brushBC };
  725.  
  726.         // Can't concatenate a $string with a $string[] to create the
  727.         // command we need to give to the script job.  This creates
  728.         // one string for the command.
  729.         //
  730.         string $reconnectCmd = "dynPaintToolbarConnectControls ";
  731.         for( $connectThis in $controlsToConnect ) {
  732.             $reconnectCmd = ( $reconnectCmd + $connectThis + " " );
  733.         }
  734.  
  735.         // Now connect up the toolbar controls to the attributes
  736.         // on the default brush they need to listen to.
  737.         //
  738.         eval( $reconnectCmd );
  739.  
  740.         // And since the default brush will be deleted on file->new,
  741.         // the controls listed above will be disabled, since node
  742.         // for which they were watching attributes no longer exists.
  743.         // 
  744.         // We have to reconnect the controls to the "new" default
  745.         // brush.  
  746.         //
  747.         scriptJob -protected -parent $toolbar -event NewSceneOpened $reconnectCmd;
  748.         scriptJob -protected -parent $toolbar -event SceneOpened $reconnectCmd;
  749.  
  750.         setParent ..;
  751.  
  752.     if( `dynPaintEditor -q -canvasMode $editor` )
  753.     {
  754.         showDynPaintSceneTools( false );
  755.     }
  756.     else
  757.     {
  758.         showDynPaintSceneTools( true );
  759.     }
  760.     setShowTubeTools();
  761.  
  762.     return( $toolbar );
  763. }
  764.